// 初始化映射关系 - 原因分类
export const delayOpinionMapping = new Map([
    ["非网络问题->其他->其他(含客户无法配合处理)", { closureOpinion: "用户不配合" }],
    ["手机上网->非网络问题->其他->其他(含客户无法配合处理)", { closureOpinion: "用户不配合" }],
    ["非网络问题->非网络问题->其他->其他(含客户无法配合处理)", { closureOpinion: "用户不配合" }],
    ["网络问题->网络覆盖->4G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["手机上网->网络问题->网络覆盖->4G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["手机上网->网络问题->网络覆盖->5G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["手机上网->非网络问题->终端问题->终端设置错误", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->非网络问题->SIM卡问题->老旧SIM卡需要升级", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->网络问题->网络容量->长期容量(大于3天)", { closureOpinion: "网络问题-负荷问题" }],
    ["手机上网->网络问题->SIM卡问题->SIM卡物理损坏", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->非网络问题->SIM卡问题->SIM卡签约数据异常", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->网络问题->网络故障->系统版本问题/参数异常", { closureOpinion: "网络问题-故障" }],
    ["非网络问题->SIM卡问题->SIM卡签约数据异常", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["非网络问题->SIM卡问题->老旧SIM卡需要升级", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["非网络问题->SIM卡问题->老旧SIM卡需要升级", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["网络问题->网络故障->4G基站故障", { closureOpinion: "网络问题-故障" }],
    ["网络问题->网络容量->长期容量(大于3天)", { closureOpinion: "网络问题-负荷问题" }],
    ["通话质量->网络问题->网络覆盖->4G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["非网络问题->终端问题->终端设置错误", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->非网络问题->终端问题->终端性能差或手机接收信号功能损坏", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->网络问题->网络覆盖->过覆盖->天线设置不合理", { closureOpinion: "网络问题-过覆盖" }],
    ["通话质量->非网络问题->其他->其他(含客户无法配合处理)", { closureOpinion: "用户不配合" }],
    ["网络问题->网络干扰->外部干扰", { closureOpinion: "网络问题-干扰" }],
    ["网络问题->网络故障->物业纠纷、网络搬迁", { closureOpinion: "网络问题-故障" }],
    ["网络问题->网络故障->系统版本问题/参数异常", { closureOpinion: "网络问题-故障" }],
    ["手机上网->网络问题->网络故障->5G基站故障", { closureOpinion: "网络问题-故障" }],
    ["手机上网->网络问题->网络容量->短期容量(1-3天)", { closureOpinion: "网络问题-负荷问题" }],
    ["网络问题->网络覆盖->5G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["非网络问题->SIM卡问题->SIM卡物理损坏", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["更换SIM卡", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["手机上网->网络问题->网络故障->4G基站故障", { closureOpinion: "网络问题-故障" }],
    ["手机上网->网络问题->网络故障->物业纠纷、网络搬迁", { closureOpinion: "网络问题-故障" }],
    ["非网络问题->终端问题->终端性能差或手机接收信号功能损坏", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->网络问题->其他->未知网络因素", { closureOpinion: "其他-非网络问题" }],
    ["手机上网->网络问题->网络覆盖->过覆盖->参数设置不合格", { closureOpinion: "网络问题-过覆盖" }],
    ["手机上网->网络问题->网络干扰->外部干扰", { closureOpinion: "网络问题-干扰" }],
    ["通话质量->非网络问题->SIM卡问题->SIM卡物理损坏", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["通话质量->非网络问题->SIM卡问题->SIM卡签约数据异常", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["通话质量->非网络问题->终端问题->终端设置错误", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->网络问题->网络覆盖->过覆盖->天线设置不合理", { closureOpinion: "网络问题-过覆盖" }],
    ["网络问题->网络故障->天线故障含室内天线/分布故障", { closureOpinion: "网络问题-故障" }],
    ["手机上网->网络问题->网络覆盖->5G弱覆盖->室外宏站弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["网络问题->其他->未知网络因素", { closureOpinion: "其他-非网络问题" }],
    ["网络问题->网络干扰->4G内部干扰", { closureOpinion: "网络问题-干扰" }],
    ["网络问题->网络故障->传输故障", { closureOpinion: "网络问题-故障" }],
    ["非网络问题->外部网站问题->单一APP问题", { closureOpinion: "单个APP问题" }],
    ["非网络问题->终端问题->终端软件版本问题", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["建议用户更换终端", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->非网络问题->宽带问题->wifi网速慢", { closureOpinion: "其他-宽带问题" }],
    ["手机上网->非网络问题->外部网站问题->单一APP问题", { closureOpinion: "单个APP问题" }],
    ["手机上网->网络问题->网络干扰->4G内部干扰", { closureOpinion: "网络问题-干扰" }],
    ["手机上网->网络问题->网络故障->天线故障含室内天线/分布故障", { closureOpinion: "网络问题-故障" }],
    ["通话质量->非网络问题->SIM卡问题->老旧SIM卡需要升级", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["通话质量->非网络问题->终端问题->终端性能差或手机接收信号功能损坏", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["通话质量->非网络问题->网络故障->系统版本问题/参数异常", { closureOpinion: "网络问题-故障" }],
    ["网络问题->网络覆盖->4G弱覆盖->室外宏站弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["网络问题->网络容量->过覆盖->参数设置不合理", { closureOpinion: "网络问题-过覆盖" }],
    ["网络问题->网络干扰->大气波导干扰", { closureOpinion: "网络问题-干扰" }],
    ["非网络问题->宽带问题->宽带无法正常使用", { closureOpinion: "其他-宽带问题" }],
    ["沟通解释及协助用户完成终端设置", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["手机上网->非网络问题->宽带问题->宽带无法正常使用", { closureOpinion: "其他-宽带问题" }],
    ["手机上网->网络问题->网络覆盖->2G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["手机上网->网络问题->网络覆盖->过覆盖->室外分外泄设置不合理", { closureOpinion: "过覆盖" }],
    ["手机上网->网络问题->网络覆盖->重叠覆盖->天线设置不合理", { closureOpinion: "过覆盖" }],
    ["手机上网->网络问题->网络故障->市电停电", { closureOpinion: "网络问题-故障" }],
    ["刷新数据", { closureOpinion: "业务问题" }],
    ["通话质量->非网络问题->SIM卡问题->SIM卡签约数据异常", { closureOpinion: "终端问题或SIM卡问题-SIM卡问题" }],
    ["通话质量->非网络问题->终端问题->终端设置错误", { closureOpinion: "终端问题或SIM卡问题-终端问题" }],
    ["网络问题->网络覆盖->2G弱覆盖->室内深度弱覆盖", { closureOpinion: "网络问题-弱覆盖" }],
    ["网络问题->网络覆盖->重叠覆盖->室内深度弱覆盖", { closureOpinion: "过覆盖" }],
    ["网络问题->网络覆盖->重叠覆盖->天线设置不合理", { closureOpinion: "过覆盖" }],
    ["网络问题->网络故障->2G基站故障", { closureOpinion: "网络问题-故障" }],
    ["网络问题->网络故障->市电停电", { closureOpinion: "网络问题-故障" }],
    ["网络问题->网络容量->突发拥塞(1天)", { closureOpinion: "网络问题-负荷问题" }]
]);

// 首次 - 解决措施
export const delaySolutionMappingOne = new Map([
    ["沟通解释", { delayTime: "7天" }],
    ["新建提升4G覆盖", { delayTime: "90天" }],
    ["优化提升4G覆盖", { delayTime: "5天" }],
    ["沟通解释及协助用户完成终端设置", { delayTime: "5天" }],
    ["SIM卡升级", { delayTime: "5天" }],
    ["安装滑格宝", { delayTime: "10天" }],
    ["新建提升5G覆盖", { delayTime: "90天" }],
    ["扩容优化", { delayTime: "7天" }],
    ["优化提升5G覆盖", { delayTime: "5天" }],
    ["更换SIM卡", { delayTime: "5天" }],
    ["刷新数据", { delayTime: "5天" }],
    ["故障处理", { delayTime: "3天" }],
    ["参数调整", { delayTime: "3天" }],
    ["新建均衡", { delayTime: "90天" }],
    ["建议用户更换终端", { delayTime: "5天" }],
    ["干扰排查并协调干扰源关闭", { delayTime: "5天" }],
    ["天馈调整降低过覆盖", { delayTime: "7天" }],
    ["基站回填", { delayTime: "14天" }],
    ["现场排查等", { delayTime: "5天" }],
    ["参数调整降低过覆盖", { delayTime: "3天" }],
    ["负载均衡", { delayTime: "3天" }],
    ["干扰排查并优化整改", { delayTime: "5天" }],
    ["转家宽专业处理", { delayTime: "3天" }],
    ["测试优化", { delayTime: "5天" }],
    ["调整天馈降低重叠覆盖", { delayTime: "7天" }],
    ["更换终端", { delayTime: "5天" }],
    ["基站搬迁", { delayTime: "3天" }],
    ["启动抗干扰机制", { delayTime: "7天" }],
    ["室分整改降低过覆盖", { delayTime: "14天" }],
    ["新建提升GSM覆盖", { delayTime: "90天" }],
    ["优化提升GSM覆盖", { delayTime: "7天" }]
])

// 非首次 - 解决措施
export const delaySolutionMappingNotOne = new Map([
    ["沟通解释", { delayTime: "5天" }],
    ["沟通解释及协助用户完成终端设置", { delayTime: "5天" }],
    ["更换终端", { delayTime: "5天" }],
    ["更换SIM卡", { delayTime: "5天" }],
    ["插拔SIM卡", { delayTime: "5天" }],
    ["更换卡槽", { delayTime: "5天" }],
    ["HLR同步", { delayTime: "5天" }],
    ["VOLTE重置", { delayTime: "5天" }],
    ["VOLTE开通", { delayTime: "5天" }],
    ["参数调整", { delayTime: "4天" }],
    ["基站搬迁", { delayTime: "3天" }],
    ["功率调整", { delayTime: "3天" }],
    ["天馈调整", { delayTime: "7天" }],
    ["femto", { delayTime: "10天" }],
    ["基站整改", { delayTime: "14天" }],
    ["室分零星增补", { delayTime: "14天" }],
    ["室分工程增补", { delayTime: "14天" }],
    ["建站", { delayTime: "90天" }],
    ["满格宝", { delayTime: "10天" }],
    ["排障", { delayTime: "3天" }],
    ["均衡", { delayTime: "4天" }],
    ["软扩", { delayTime: "5天" }],
    ["硬扩", { delayTime: "8天" }],
    ["干扰排查", { delayTime: "5天" }],
    ["割接", { delayTime: "3天" }],
    ["转家宽处理", { delayTime: "4天" }]
]);

// 根据输入查找对应的结果
export const mapInput = (input, mapping) => {
    const result = mapping.get(input);
    return result || null; // 如果没有找到匹配项，返回null
}


/**
 * 获取原因分类下拉框
 * 将 Map 对象转换为去重后的数组
 * @param {Map} map - 包含键值对的 Map 对象
 * @returns {Array} - 去重后的数组，每个元素包含 label 和 value 属性
 */
export const getClosureOpinion = () => {
    // 使用 Set 数据结构来去重
    const uniqueSet = new Set();

    // 遍历 Map 对象，将 closureOpinion 添加到 Set 中
    delayOpinionMapping.forEach((value) => {
        uniqueSet.add(value.closureOpinion);
    });

    // 删除弱覆盖
    uniqueSet.delete("过覆盖");

    // 将 Set 转换为数组，并映射为包含 label 和 value 属性的对象
    return Array.from(uniqueSet).map((opinion) => ({
        label: opinion,
        value: opinion,
    }));
}

/**
 * 获取解决措施下拉框
 */
export const getSolutionOpinion = (mapping) => {
    // 转换为数组格式
    const delaySolutionMappingOneArray = [];
    mapping.forEach((value, key) => {
        delaySolutionMappingOneArray.push({ label: key, value: key });
    });

    return delaySolutionMappingOneArray;
}